package com.blt.car.me;

import android.widget.ListView;

import com.blt.car.R;
import com.blt.car.base.BaseTitleBarActivity;
import com.blt.car.base.ViewHolder;
import com.blt.car.me.adapter.IntegralAdapter;

import java.util.List;

import blt.app_core.api.base.CoreEvent;
import blt.app_core.api.base.CoreManager;
import blt.app_core.api.journey.JourneyApi;
import blt.app_core.api.journey.bean.Travel;

/**
 * Created by xgp on 2017/6/27.
 */

public class MyIntegralActivity extends BaseTitleBarActivity {

    private ListView mListView;
    private IntegralAdapter integralAdapter;
    private int page = 1;
    private int size = 15;

    @Override
    protected int getLayoutId() {
        return R.layout.activity_my_integral;
    }

    @Override
    protected void initData() {
        super.initData();
        CoreManager.getCore(JourneyApi.class).getTravel(page, size,false,false);
    }

    @Override
    protected void initView(ViewHolder holder) {
        mTitleBar.setTitle("我的积分");
        mListView = holder.get(R.id.integral_listview);
        integralAdapter = new IntegralAdapter(this);
        mListView.setAdapter(integralAdapter);
    }


    @CoreEvent(coreClientClass = JourneyApi.class)
    public void onTravel(Travel travel) {
        integralAdapter.add(travel.travelOrderList);
    }
}
